﻿using System;
using System.Web;
using System.Web.UI.WebControls;

namespace VitCode.Castle.Helper
{
    /// <summary>
    /// javascript Alert 
    /// </summary>
    public sealed class Alert : System.Web.UI.Page
    {
        /// <summary>
        /// javaScript的彈出訊息方塊
        /// </summary>
        /// <param name="showValue">輸出內容</param>
        public static  void MessageBox(string showValue)
        {
            if(!string.IsNullOrEmpty(showValue))
                showValue = showValue.Replace("\r\n", "\\r\\n");
            HttpContext.Current.Response.Write("<script language='javascript' type='text/javascript'>alert('" + showValue + "');</script>");
        }

  

        /// <summary>
        /// 輸出內容頁面字體不變形的解決方案
        /// </summary>
        /// <param name="page"></param>
        /// <param name="values"></param>
        public static void WebMessageBox(System.Web.UI.Page page, string values)
        { 
            page.RegisterClientScriptBlock("資訊提示", "<script language='javascript'>alert(\"" + values + "\")</script>");
        }
          
        
    }
}
